# Assemble program
filename=main
let format_id_counter=1
let nsf_format_id=nes_format_id=fds_format_id=0
for format in "nsf" "nes" "fds"
do
output_filename="output.${format}"
rm "${output_filename}"
let ${format}_format_id=${format_id_counter}
echo Entering build-system\'s ${format} loop...
asar \
	-DNSF_FORMAT=${nsf_format_id}\
	-DINES_FORMAT=${nes_format_id}\
	-DFDS_FORMAT=${fds_format_id}\
	--fix-checksum=off\
	--no-title-check\
	-Doutput_format=${format_id_counter}\
	"${filename}.s"\
	"${output_filename}"
chmod 777 "${output_filename}"
let format_id_counter++
done
echo Done!  Beginning emulator execution && cp output.nes $(dirname $(which mame)) && cd $(dirname $(which mame)) && mame nes -skip_gameinfo -cart output.nes -debug
#../XMPlay/xmplay.exe test.nsf